import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;


import com.yingying.tools.Tools;

/**
 * @ClassName: AmberBakery
 * @Description:
 * @author chendong
 * @date 2017年3月26日 上午10:20:36
 */
public class Http {
	public static void main(String[] args) throws IOException {
		Map<String, String> headermap = new HashMap<>();
		headermap.put("test", "11");
		Map<String, String> params = new HashMap<>();
		params.put("username", "chendong");
		params.put("password", "dada");
		params.put("email", "jkkk");
		InputStream src = Http.class.getResourceAsStream("/pic/green.jpg");
		byte[] ss = Tools.toByteArray(src);
		String str =  new String(ss, "utf-8");
		params.put("picbit", URLEncoder.encode(str, "UTF-8"));
		Tools.requestByPostMethod("http://127.0.0.1:8080/AmberBakery/register.do", params, headermap);
		System.out.println("success");
	}
}
